package com.education.wisdom.controller.app;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.education.common.core.BaseController;
import com.education.common.utils.BusinessType;
import com.education.common.utils.LogUtil;
import com.education.common.utils.UUIDUtils;
import com.education.wisdom.pojo.HelpResources;
import com.education.wisdom.service.IHelpResourcesService;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;


/**
 * 解决求助资源 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-02-19
 */
@Controller
@Api(tags = {"求助 信息操作处理"})
@CrossOrigin
@Slf4j
@RequestMapping("/appHelpResources")
public class AppHelpResourcesController extends BaseController
{
    private String prefix = "system/helpResources";
	
	@Autowired
	private IHelpResourcesService helpResourcesService;
	
	@GetMapping()
	public String helpResources()
	{
	    return prefix + "/helpResources";
	}
	
	/**
	 * 新增解决求助资源
	 */
	@ApiOperation("新增解决求助资源")
	@PostMapping("/addHelpResources")
	@ResponseBody
	public void addHelp(HttpServletResponse response, HttpServletRequest request, HelpResources helpResources) throws Exception{
			log.info(LogUtil.LogInfo("新增解决求助资源",new Date()));
			helpResources.setCreateTime(new Date());
			helpResources.setResourcesId(UUIDUtils.getByUUId());
			writeJSON(helpResourcesService.insertHelpResources(helpResources), response, "200", "success");
			
	}
	
	
}
